/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package util;

/**
 *
 * @author kien.tran
 */
public class DataUtils {

    public static String[] validate(String[] items, int[] indexes){
        String[] array = new String[items.length];

        for (int i = 0; i < indexes.length; i++){
            if ((items[indexes[i]] == null) || (items[indexes[i]].trim().length() == 0)){
                return null;
            }
        }

        for (int j = 0; j < items.length ; j++){
            if (items[j] == null){
                array[j] = "";
            } else {
                array[j] = items[j];
            }
        }

        return array;
    }
}
